<script setup>
import { onBeforeUnmount, onUnmounted } from "vue";

// 组件卸载之前
onBeforeUnmount(() => {
  console.log("onBeforeUnmount");
  debugger;
});

// 组件卸载之后
onUnmounted(() => {
  console.log("onUnmounted");
  debugger;
});
</script>

<template>
  <div>子组件</div>
</template>
